const md = require('../../utils/md5.js');
const app = getApp();
const post = require('../../utils/post.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var accid = wx.getStorageInfoSync('DepID');
    if(!accid){
      that.setData({
        money:0
      })
      return;
    }
    var datas = {};
    datas.where = "TranType ='MB' and AccID="+accid;
    var datacall = function (res) {
      console.log(res);
      var list = res.data.data;
      if(list.length==0){
        that.setData({
          money:0
        })
      }else{
        var money=0;
        for(var i=0;i<list.length;i++){
          money+=list[i].MnyHap;
        }
        that.setData({
          money:money
        })
      }
    }
    var res2 = post.getdata("/BO/TR_Detail/Query", datas, datacall);
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (res) {
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '注册既得66元大礼包！！！',
      path: '/pages/login/login?fromid=' + wx.getStorageSync('userinfo').MebID,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  }
})